#lang racket

(define (sqr-tree tree)
  (cond ((null? tree) '())
        ((not (pair? tree)) (* tree tree))
        (else (cons (sqr-tree (car tree)) (sqr-tree (cdr tree))))))

(define (square-tree tree)
  (map (lambda (x)
         (cond ((null? x) '())
               ((not (pair? x)) (* x x))
               (else (square-tree x)))) 
       tree))

(define x (list 1 (list 2 (list 3 4) 5) (list 6 7)))

(sqr-tree x)